package com.gopay.common.util;

import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;


public class NotifyBX509TrustManager implements X509TrustManager {
	private X509TrustManager standardTrustManager = null;

	public NotifyBX509TrustManager(KeyStore keystore)throws NoSuchAlgorithmException, KeyStoreException {
		super();
		TrustManagerFactory factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
		factory.init(keystore);
	}

	@Override
    public void checkClientTrusted(X509Certificate[] certificates,
                                   String authType) throws CertificateException {
	}

	@Override
    public void checkServerTrusted(X509Certificate[] certificates,
                                   String authType) throws CertificateException {
	}

	@Override
    public X509Certificate[] getAcceptedIssuers() {
		return this.standardTrustManager.getAcceptedIssuers();
	}
}